package com.tongda.core.utils;

import java.util.Comparator;

import com.tongda.core.vo.Dish;

public class DishComparator implements Comparator<Dish> {

	@Override
	public int compare(Dish d1, Dish d2) {
		if (d1 == null || d2 == null) {
			return -1;
		}
		int index1 = d1.getStrIndexOfSearchCode(getCode());
		int index2 = d2.getStrIndexOfSearchCode(getCode());
		if (index1 > index2) {
			return 1;
		} else if (index1 < index2) {
			return -1;
		} else {
			return 0;
		}
	}

	private String code = "";

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

}
